﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="StockTicker.aspx.cs" Inherits="Derrick.Web.StockTicker" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Simple Stock Ticker application</title>

    <script type="text/javascript" src="Scripts/jquery-1.7.1.js"></script>
<script type="text/javascript" src="Scripts/Json2.js"></script>
<script type="text/javascript" src="Scripts/DateTime.js"></script>
<script type="text/javascript" language="javascript">

    function getResponse() {


        var currentDate = new Date();
        var sendMessage = JSON.stringify({
            SendTimestamp: currentDate,
            Message: "Message 1"
        });

        $.ajaxSetup({
            url: "CometProxy.aspx",
            type: "POST",
            async: true,
            global: true,
            timeout: 600000,
            contentType: "StockData"
        });


        $.ajax({
            success: function (msg) {
                //alert("ajax.success().");
                if (msg == null || msg.Message == null) {
                    getResponse();
                    return;
                }
                $("#_receivedMsgLabel").append(msg.Message + "<br/>");
                getResponse();
                return;
            }

        });

    }

</script>

</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    <table>
    <tr><td>MSFT</td><td id="_MSFT"></td></tr>
    <tr><td>AAPL</td><td id="_AAPL"></td></tr>
    <tr><td>IBM</td><td id="_IBM"></td></tr>
    <tr><td>GOOG</td><td id="_GOOG"></td></tr>
    </table>

    </div>
    </form>
</body>
</html>
